<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>ContextedException (Apache Commons Lang 3.3.2 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="ContextedException (Apache Commons Lang 3.3.2 API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ContextedException.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/lang3/exception/CloneFailedException.html" title="class in org.apache.commons.lang3.exception"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/commons/lang3/exception/ContextedRuntimeException.html" title="class in org.apache.commons.lang3.exception"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/lang3/exception/ContextedException.html" target="_top">Frames</a></li>
<li><a href="ContextedException.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.lang3.exception</div>
<h2 title="Class ContextedException" class="title">Class ContextedException</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">java.lang.Throwable</a></li>
<li>
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">java.lang.Exception</a></li>
<li>
<ul class="inheritance">
<li>org.apache.commons.lang3.exception.ContextedException</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>, <a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">ContextedException</span>
extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a>
implements <a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a></pre>
<div class="block"><p>
 An exception that provides an easy and safe way to add contextual information.
 </p><p>
 An exception trace itself is often insufficient to provide rapid diagnosis of the issue.
 Frequently what is needed is a select few pieces of local contextual data.
 Providing this data is tricky however, due to concerns over formatting and nulls.
 </p><p>
 The contexted exception approach allows the exception to be created together with a
 list of context label-value pairs. This additional information is automatically included in
 the message and printed stack trace.
 </p><p>
 An unchecked version of this exception is provided by ContextedRuntimeException.
 </p>
 <p>
 To use this class write code as follows:
 </p>
 <pre>
   try {
     ...
   } catch (Exception e) {
     throw new ContextedException("Error posting account transaction", e)
          .addContextValue("Account Number", accountNumber)
          .addContextValue("Amount Posted", amountPosted)
          .addContextValue("Previous Balance", previousBalance)
   }
 }
 </pre>
 <p>
 or improve diagnose data at a higher level:
 </p>
 <pre>
   try {
     ...
   } catch (ContextedException e) {
     throw e.setContextValue("Transaction Id", transactionId);
   } catch (Exception e) {
     if (e instanceof ExceptionContext) {
       e.setContextValue("Transaction Id", transactionId);
     }
     throw e;
   }
 }
 </pre>
 <p>
 The output in a printStacktrace() (which often is written to a log) would look something like the following:
 </p>
 <pre>
 org.apache.commons.lang3.exception.ContextedException: java.lang.Exception: Error posting account transaction
  Exception Context:
  [1:Account Number=null]
  [2:Amount Posted=100.00]
  [3:Previous Balance=-2.17]
  [4:Transaction Id=94ef1d15-d443-46c4-822b-637f26244899]

  ---------------------------------
  at org.apache.commons.lang3.exception.ContextedExceptionTest.testAddValue(ContextedExceptionTest.java:88)
  ..... (rest of trace)
 </pre></div>
<dl><dt><span class="strong">Since:</span></dt>
  <dd>3.0</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/commons/lang3/exception/ContextedRuntimeException.html" title="class in org.apache.commons.lang3.exception"><code>ContextedRuntimeException</code></a>, 
<a href="../../../../../serialized-form.html#org.apache.commons.lang3.exception.ContextedException">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!--   -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#ContextedException()">ContextedException</a></strong>()</code>
<div class="block">Instantiates ContextedException without message or cause.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#ContextedException(java.lang.String)">ContextedException</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;message)</code>
<div class="block">Instantiates ContextedException with message, but without cause.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#ContextedException(java.lang.String, java.lang.Throwable)">ContextedException</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;message,
                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&nbsp;cause)</code>
<div class="block">Instantiates ContextedException with cause and message.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#ContextedException(java.lang.String, java.lang.Throwable, org.apache.commons.lang3.exception.ExceptionContext)">ContextedException</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;message,
                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&nbsp;cause,
                  <a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a>&nbsp;context)</code>
<div class="block">Instantiates ContextedException with cause, message, and ExceptionContext.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#ContextedException(java.lang.Throwable)">ContextedException</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&nbsp;cause)</code>
<div class="block">Instantiates ContextedException with cause, but without message.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html" title="class in org.apache.commons.lang3.exception">ContextedException</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#addContextValue(java.lang.String, java.lang.Object)">addContextValue</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;label,
               <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;value)</code>
<div class="block">Adds information helpful to a developer in diagnosing and correcting the problem.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../org/apache/commons/lang3/tuple/Pair.html" title="class in org.apache.commons.lang3.tuple">Pair</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&gt;&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#getContextEntries()">getContextEntries</a></strong>()</code>
<div class="block">Retrieves the full list of label-value pairs defined in the contextual data.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#getContextLabels()">getContextLabels</a></strong>()</code>
<div class="block">Retrieves the full set of labels defined in the contextual data.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&gt;</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#getContextValues(java.lang.String)">getContextValues</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;label)</code>
<div class="block">Retrieves all the contextual data values associated with the label.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#getFirstContextValue(java.lang.String)">getFirstContextValue</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;label)</code>
<div class="block">Retrieves the first available contextual data value associated with the label.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#getFormattedExceptionMessage(java.lang.String)">getFormattedExceptionMessage</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;baseMessage)</code>
<div class="block">Gets the contextualized error message based on a base message.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#getMessage()">getMessage</a></strong>()</code>
<div class="block">Provides the message explaining the exception, including the contextual data.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#getRawMessage()">getRawMessage</a></strong>()</code>
<div class="block">Provides the message explaining the exception without the contextual data.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html" title="class in org.apache.commons.lang3.exception">ContextedException</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html#setContextValue(java.lang.String, java.lang.Object)">setContextValue</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;label,
               <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;value)</code>
<div class="block">Sets information helpful to a developer in diagnosing and correcting the problem.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Throwable">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#addSuppressed(java.lang.Throwable)" title="class or interface in java.lang">addSuppressed</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#fillInStackTrace()" title="class or interface in java.lang">fillInStackTrace</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#getCause()" title="class or interface in java.lang">getCause</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#getLocalizedMessage()" title="class or interface in java.lang">getLocalizedMessage</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#getStackTrace()" title="class or interface in java.lang">getStackTrace</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#getSuppressed()" title="class or interface in java.lang">getSuppressed</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#initCause(java.lang.Throwable)" title="class or interface in java.lang">initCause</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#printStackTrace()" title="class or interface in java.lang">printStackTrace</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#printStackTrace(java.io.PrintStream)" title="class or interface in java.lang">printStackTrace</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#printStackTrace(java.io.PrintWriter)" title="class or interface in java.lang">printStackTrace</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#setStackTrace(java.lang.StackTraceElement[])" title="class or interface in java.lang">setStackTrace</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#toString()" title="class or interface in java.lang">toString</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!--   -->
</a>
<h3>Constructor Detail</h3>
<a name="ContextedException()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ContextedException</h4>
<pre>public&nbsp;ContextedException()</pre>
<div class="block">Instantiates ContextedException without message or cause.
 <p>
 The context information is stored using a default implementation.</div>
</li>
</ul>
<a name="ContextedException(java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ContextedException</h4>
<pre>public&nbsp;ContextedException(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;message)</pre>
<div class="block">Instantiates ContextedException with message, but without cause.
 <p>
 The context information is stored using a default implementation.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>message</code> - the exception message, may be null</dd></dl>
</li>
</ul>
<a name="ContextedException(java.lang.Throwable)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ContextedException</h4>
<pre>public&nbsp;ContextedException(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&nbsp;cause)</pre>
<div class="block">Instantiates ContextedException with cause, but without message.
 <p>
 The context information is stored using a default implementation.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>cause</code> - the underlying cause of the exception, may be null</dd></dl>
</li>
</ul>
<a name="ContextedException(java.lang.String, java.lang.Throwable)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ContextedException</h4>
<pre>public&nbsp;ContextedException(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;message,
                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&nbsp;cause)</pre>
<div class="block">Instantiates ContextedException with cause and message.
 <p>
 The context information is stored using a default implementation.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>message</code> - the exception message, may be null</dd><dd><code>cause</code> - the underlying cause of the exception, may be null</dd></dl>
</li>
</ul>
<a name="ContextedException(java.lang.String, java.lang.Throwable, org.apache.commons.lang3.exception.ExceptionContext)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ContextedException</h4>
<pre>public&nbsp;ContextedException(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;message,
                  <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&nbsp;cause,
                  <a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a>&nbsp;context)</pre>
<div class="block">Instantiates ContextedException with cause, message, and ExceptionContext.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>message</code> - the exception message, may be null</dd><dd><code>cause</code> - the underlying cause of the exception, may be null</dd><dd><code>context</code> - the context used to store the additional information, null uses default implementation</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="addContextValue(java.lang.String, java.lang.Object)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addContextValue</h4>
<pre>public&nbsp;<a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html" title="class in org.apache.commons.lang3.exception">ContextedException</a>&nbsp;addContextValue(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;label,
                                 <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;value)</pre>
<div class="block">Adds information helpful to a developer in diagnosing and correcting the problem.
 For the information to be meaningful, the value passed should have a reasonable
 toString() implementation.
 Different values can be added with the same label multiple times.
 <p>
 Note: This exception is only serializable if the object added is serializable.
 </p></div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html#addContextValue(java.lang.String, java.lang.Object)">addContextValue</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>label</code> - a textual label associated with information, <code>null</code> not recommended</dd><dd><code>value</code> - information needed to understand exception, may be <code>null</code></dd>
<dt><span class="strong">Returns:</span></dt><dd><code>this</code>, for method chaining, not <code>null</code></dd></dl>
</li>
</ul>
<a name="setContextValue(java.lang.String, java.lang.Object)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setContextValue</h4>
<pre>public&nbsp;<a href="../../../../../org/apache/commons/lang3/exception/ContextedException.html" title="class in org.apache.commons.lang3.exception">ContextedException</a>&nbsp;setContextValue(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;label,
                                 <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;value)</pre>
<div class="block">Sets information helpful to a developer in diagnosing and correcting the problem.
 For the information to be meaningful, the value passed should have a reasonable
 toString() implementation.
 Any existing values with the same labels are removed before the new one is added.
 <p>
 Note: This exception is only serializable if the object added as value is serializable.
 </p></div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html#setContextValue(java.lang.String, java.lang.Object)">setContextValue</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>label</code> - a textual label associated with information, <code>null</code> not recommended</dd><dd><code>value</code> - information needed to understand exception, may be <code>null</code></dd>
<dt><span class="strong">Returns:</span></dt><dd><code>this</code>, for method chaining, not <code>null</code></dd></dl>
</li>
</ul>
<a name="getContextValues(java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getContextValues</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&gt;&nbsp;getContextValues(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;label)</pre>
<div class="block">Retrieves all the contextual data values associated with the label.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html#getContextValues(java.lang.String)">getContextValues</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>label</code> - the label to get the contextual values for, may be <code>null</code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the contextual values associated with the label, never <code>null</code></dd></dl>
</li>
</ul>
<a name="getFirstContextValue(java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFirstContextValue</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;getFirstContextValue(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;label)</pre>
<div class="block">Retrieves the first available contextual data value associated with the label.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html#getFirstContextValue(java.lang.String)">getFirstContextValue</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>label</code> - the label to get the contextual value for, may be <code>null</code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the first contextual value associated with the label, may be <code>null</code></dd></dl>
</li>
</ul>
<a name="getContextEntries()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getContextEntries</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../org/apache/commons/lang3/tuple/Pair.html" title="class in org.apache.commons.lang3.tuple">Pair</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&gt;&gt;&nbsp;getContextEntries()</pre>
<div class="block">Retrieves the full list of label-value pairs defined in the contextual data.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html#getContextEntries()">getContextEntries</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the list of pairs, not <code>null</code></dd></dl>
</li>
</ul>
<a name="getContextLabels()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getContextLabels</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;getContextLabels()</pre>
<div class="block">Retrieves the full set of labels defined in the contextual data.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html#getContextLabels()">getContextLabels</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the set of labels, not <code>null</code></dd></dl>
</li>
</ul>
<a name="getMessage()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMessage</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getMessage()</pre>
<div class="block">Provides the message explaining the exception, including the contextual data.</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#getMessage()" title="class or interface in java.lang">getMessage</a></code>&nbsp;in class&nbsp;<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the message, never null</dd><dt><span class="strong">See Also:</span></dt><dd><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#getMessage()" title="class or interface in java.lang"><code>Throwable.getMessage()</code></a></dd></dl>
</li>
</ul>
<a name="getRawMessage()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRawMessage</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getRawMessage()</pre>
<div class="block">Provides the message explaining the exception without the contextual data.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>the message</dd><dt><span class="strong">Since:</span></dt>
  <dd>3.0.1</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true#getMessage()" title="class or interface in java.lang"><code>Throwable.getMessage()</code></a></dd></dl>
</li>
</ul>
<a name="getFormattedExceptionMessage(java.lang.String)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getFormattedExceptionMessage</h4>
<pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getFormattedExceptionMessage(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;baseMessage)</pre>
<div class="block">Gets the contextualized error message based on a base message.
 This will add the context label-value pairs to the message.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html#getFormattedExceptionMessage(java.lang.String)">getFormattedExceptionMessage</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/commons/lang3/exception/ExceptionContext.html" title="interface in org.apache.commons.lang3.exception">ExceptionContext</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>baseMessage</code> - the base exception message <b>without</b> context information appended</dd>
<dt><span class="strong">Returns:</span></dt><dd>the exception message <b>with</b> context information appended, not <code>null</code></dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ContextedException.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/lang3/exception/CloneFailedException.html" title="class in org.apache.commons.lang3.exception"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/commons/lang3/exception/ContextedRuntimeException.html" title="class in org.apache.commons.lang3.exception"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/lang3/exception/ContextedException.html" target="_top">Frames</a></li>
<li><a href="ContextedException.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2001&#x2013;2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
